# !usr/bin/env python
# -*- coding:utf-8 _*-
"""
@Author:张广勤
@Web site: https://www.tunan.wang
@Github:www.github.com
 
@File:date_list1_0.py
@Time:2024/12/4 15:45

@Motto:不积跬步无以至千里，不积小流无以成江海！
"""
from datetime import datetime, timedelta
from cctv_news import datetime1_0
from cctv_news import newdate1_0

# 函数用于生成从开始日期到结束日期的日期列表
def generate_date_list(start_date_str, end_date_str):
    start_date = datetime.strptime(start_date_str, '%Y%m%d')
    end_date = datetime.strptime(end_date_str, '%Y%m%d')

    # 包括起始和结束日期在内的日期列表
    date_list = [start_date + timedelta(days=x) for x in range((end_date - start_date).days + 1)]

    return date_list


# # 给定的起始和最后日期
# # start_date = '20240101'
# csv_file_path = '../news/outputnews_2024.csv'
# start_date = newdate1_0.find_latest_date(csv_file_path)
# # end_date = '20240310'
# end_date = datetime1_0.date_yesterday()
#
# # 构造日期列表
# date_list = generate_date_list(start_date, end_date)
#
# # 打印日期列表
# for date in date_list:
#     print(date.strftime('%Y%m%d'))